# !/usr/bin/env python
# coding=utf-8
# @Time    : 2019/11/6 16:21
# @Author  : 6imensiva
# @Site    : https://gitee.com/dimensiva/SeleniumCrapy.git
# @File    : my_image.py
# @Software: PyCharm
# @Version: 2.7.5
import base64
import skimage.io
import matplotlib.pyplot as plt  # plt 用于显示图片


def show_image(data):
	plt.imshow(data)  # 显示图片
	plt.axis('off')  # 不显示坐标轴
	plt.show()


def base64_to_rgb(base64_str):
    """
    默认base64中的图像为rgb，直接转换成即可
    :param base64:
    :return:
    """
    if isinstance(base64_str, bytes):
        base64_str = base64_str.decode("utf-8")

    img_data = base64.b64decode(base64_str, '-_')
    img = skimage.io.imread(img_data, plugin='imageio')
    return img